#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date    : 2018-02-03 12:16:56

import pika


mq_server = '192.168.232.129'
credential = pika.PlainCredentials(username='king', password='king123')
conncetion = pika.BlockingConnection(
    pika.ConnectionParameters(mq_server, 5672, '/', credential))
channel = conncetion.channel()

# 创建一个queue
channel.queue_declare(queue='jin')
channel.basic_publish(exchange='', routing_key='king', body='king hello')
channel.basic_publish(exchange='', routing_key='jin', body='jin hello')
print("send king hello")
channel.close()
conncetion.close()
